<?php
namespace app\home\controller;
use think\Input;
use think\Db;
use clt\Leftnav;
use think\Request;
use think\Controller;
class Common extends Controller{
    protected $pagesize;
    public function _initialize(){
		$this->is_login();
    }
	
    public function _empty(){
        return $this->error('空操作，返回上次访问页面中...');
    }

    // 是否登录
    public function is_login()
    {
        //判断是否登录
        if (!session('home_uid')) {
            $this->redirect(url('login/index'));
        }
    }
	
	//增加全局log
	public function add_log($m_id, $money, $memo, $type, $old_money, $new_money){
		$map['m_id'] = $m_id;
		$map['money'] = $money;
		$map['memo'] = $memo;
		$map['type'] = $type;
		$map['old_money'] = $old_money;
		$map['new_money'] = $new_money;
		$map['add_time'] = date("Y-m-d H:i:s");
		db('log')->insert($map);
	}
}